<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script src="layui/layui.js" type="text/javascript" charset="UTF-8"></script>
<link href="layui/css/layui.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.8.2.js" charset="UTF-8"></script>
</head>
<body>
<h1>登录</h1>
<form class="layui-form" action="">
  <div class="layui-form-item">
    <label class="layui-form-label">用户名</label>
    <div class="layui-input-block">
      <input type="text" name="name" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">密码</label>
    <div class="layui-input-inline">
      <input type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
    </div>
    <div class="layui-form-mid layui-word-aux">输入你的密mm</div>
  </div>
 
  
  
 
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit lay-filter="formDemo" id="b">登录</button>
      <button type="button" class="layui-btn layui-btn-primary" id="a">注册</button>
    </div>
  </div>
</form>
 
<script>
//Demo
layui.use('form', function(){
  var form = layui.form;
  
  
  $("#b").click(function(){
	    
	    var layer = layui.layer;
	    
	    layer.open({
	    	  type: 2,
	    	  skin: 'layui-layer-rim', //加上边框
	    	  area: ['600px', '600px'], //宽高
	    	  content: 'Qb'
	    	});
	  });

  
  $("#a").click(function(){
	    
	    var layer = layui.layer;
	    
	    layer.open({
	    	  type: 2,
	    	  skin: 'layui-layer-rim', //加上边框
	    	  area: ['600px', '600px'], //宽高
	    	  content: 'add.html'
	    	});
	  });
  
  //监听提交
  form.on('submit(formDemo)', function(data){
    layer.msg(JSON.stringify(data.field));
    return false;
  });
})
</script>
</body>
</html>
